/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bs.beans;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Bone
 */
@Entity
@Table(name = "PARAMETROS_RELATORIO", catalog = "", schema = "")
@NamedQueries({
    @NamedQuery(name = "ParametrosRelatorio.findAll", query = "SELECT p FROM ParametrosRelatorio p"),
    @NamedQuery(name = "ParametrosRelatorio.findById", query = "SELECT p FROM ParametrosRelatorio p WHERE p.id = :id"),
    @NamedQuery(name = "ParametrosRelatorio.findByNomeParametro", query = "SELECT p FROM ParametrosRelatorio p WHERE p.nomeParametro = :nomeParametro"),
    @NamedQuery(name = "ParametrosRelatorio.findByTexto", query = "SELECT p FROM ParametrosRelatorio p WHERE p.texto = :texto"),
    @NamedQuery(name = "ParametrosRelatorio.findByTipo", query = "SELECT p FROM ParametrosRelatorio p WHERE p.tipo = :tipo"),
    @NamedQuery(name = "ParametrosRelatorio.findByConsulta", query = "SELECT p FROM ParametrosRelatorio p WHERE p.consulta = :consulta"),
    @NamedQuery(name = "ParametrosRelatorio.findByCampoRetorno", query = "SELECT p FROM ParametrosRelatorio p WHERE p.campoRetorno = :campoRetorno"),
    @NamedQuery(name = "ParametrosRelatorio.findByCampo", query = "SELECT p FROM ParametrosRelatorio p WHERE p.campo = :campo")})
public class ParametrosRelatorio implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID")
    @GeneratedValue(generator = "GEN_PARAMETROS_RELATORIO",strategy = GenerationType.SEQUENCE)
    @SequenceGenerator(name = "GEN_PARAMETROS_RELATORIO",allocationSize = 1,sequenceName = "SQ_PARAMETROS_RELATORIO")
    private Integer id;
    @Column(name = "NOME_PARAMETRO")
    private String nomeParametro;
    @Column(name = "TEXTO")
    private String texto;
    @Column(name = "TIPO")
    private String tipo;
    @Column(name = "CONSULTA")
    private String consulta;
    @Column(name = "CAMPO_RETORNO")
    private String campoRetorno;
    @Column(name = "CAMPO")
    private String campo;
    @JoinColumn(name = "RELATORIO", referencedColumnName = "ID")
    @ManyToOne
    private Relatorios relatorio;

    public ParametrosRelatorio() {
    }

    public ParametrosRelatorio(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        Integer oldId = this.id;
        this.id = id;
        changeSupport.firePropertyChange("id", oldId, id);
    }

    public String getNomeParametro() {
        return nomeParametro;
    }

    public void setNomeParametro(String nomeParametro) {
        String oldNomeParametro = this.nomeParametro;
        this.nomeParametro = nomeParametro;
        changeSupport.firePropertyChange("nomeParametro", oldNomeParametro, nomeParametro);
    }

    public String getTexto() {
        return texto;
    }

    public void setTexto(String texto) {
        String oldTexto = this.texto;
        this.texto = texto;
        changeSupport.firePropertyChange("texto", oldTexto, texto);
    }

    public String getTipo() {
        return tipo;
    }

    public void setTipo(String tipo) {
        String oldTipo = this.tipo;
        this.tipo = tipo;
        changeSupport.firePropertyChange("tipo", oldTipo, tipo);
    }

    public String getConsulta() {
        return consulta;
    }

    public void setConsulta(String consulta) {
        String oldConsulta = this.consulta;
        this.consulta = consulta;
        changeSupport.firePropertyChange("consulta", oldConsulta, consulta);
    }

    public String getCampoRetorno() {
        return campoRetorno;
    }

    public void setCampoRetorno(String campoRetorno) {
        String oldCampoRetorno = this.campoRetorno;
        this.campoRetorno = campoRetorno;
        changeSupport.firePropertyChange("campoRetorno", oldCampoRetorno, campoRetorno);
    }

    public String getCampo() {
        return campo;
    }

    public void setCampo(String campo) {
        String oldCampo = this.campo;
        this.campo = campo;
        changeSupport.firePropertyChange("campo", oldCampo, campo);
    }

    public Relatorios getRelatorio() {
        return relatorio;
    }

    public void setRelatorio(Relatorios relatorio) {
        Relatorios oldRelatorio = this.relatorio;
        this.relatorio = relatorio;
        changeSupport.firePropertyChange("relatorio", oldRelatorio, relatorio);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ParametrosRelatorio)) {
            return false;
        }
        ParametrosRelatorio other = (ParametrosRelatorio) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bs.beans.ParametrosRelatorio[ id=" + id + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
